<!DOCTYPE html>
<html lang="zh-CN">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>18.自定义指令</title>
  </head>
  <body>
    <div id="app">
      <p v-text="msg"></p>
      <p v-upper="msg"></p>
    </div>
    <script src="https://cdn.bootcdn.net/ajax/libs/vue/2.6.14/vue.js"></script>
    <script>
      new Vue({
        el: "#app",
        data: {
          msg: "hello",
        },
        directives: {
          upper(node, bindings) {
            node.textContent = bindings.value.toUpperCase();
          },
        },
      });
    </script>
  </body>
</html>
